<?php
$thisclass  = & class_info($this_cata_id);
listseo($thisclass);
$save	= @(int)$_POST['save'];
$chknumber	= trim($_POST['chknumber']);
if($save	== 1) {
    if($chknumber	!= $_SESSION['randcode']) {
        $info='验证码有误！';
        $second = '3';
        $urlnamedd='申请加盟';
        $url    = "$G_web_root/jiameng.html";
        $msg    = '<font style="color:red">操作失败！</font>';
        $tpl->assign(get_defined_vars());
        $tpl->display('showmessage.html');
    	exit();
    }
    $tbl_main   = 'yu_sqjm';
    $conn   = & get_db_conn();
    $result['cmname']= trim($_POST['cmname']);
    $result['realname']= trim($_POST['realname']);
    $result['gender']= trim($_POST['gender']);
    $result['phone']= trim($_POST['phone']);
    $result['qq']= trim($_POST['qq']);
    $result['area']=trim($_POST['area']);
    $result['address']=trim($_POST['address']);
    $result['workexp']=trim($_POST['workexp']);
    $result['ip']=realip();
    $result['addtime']=mktime();
    $sql = "SELECT COUNT(*) AS rs_count FROM $tbl_main WHERE cmname = '{$result['cmname']}' and realname = '{$result['realname']}' and phone = '{$result['phone']}' ";
    $rs = $conn->GetOne($sql);
    if($rs) {
        $info='同样的内容已被提交!';
        $second = '3';
        $urlnamedd='申请加盟';
        $url    = "$G_web_root/jiameng.html";
        $msg    = '<font style="color:red">操作失败！</font>';
        $tpl->assign(get_defined_vars());
        $tpl->display('showmessage.html');
    	exit();
    } else {
        $conn->AutoExecute($tbl_main,$result,'INSERT');
        $id = $conn->Insert_ID();
        if($id){
            $info='申请加盟成功！';
            $url="$G_web_root/jiameng.html";
            $second = '3';
            $urlnamedd='申请加盟';
            $msg    = '操作成功';
            $tpl->assign(get_defined_vars());
            $tpl->display('showmessage.html');
        	exit();
        }else{
            $info='提交失败，请重试！';
            $second = '3';
            $urlnamedd='留言';
            $url    = "$G_web_root/jiameng.html";
            $msg    = '<font style="color:red">操作失败！</font>';
            $tpl->assign(get_defined_vars());
            $tpl->display('showmessage.html');
        	exit();
        }
    }
}
$tpl->assign(array(
    'seo_title'     => '申请加盟_'.$seo_title,
    'seo_keywords'  => $seo_keywords,
    'seo_description' => $seo_description,
));
$tpl->display($tpl_msg);
?>